home *** CD-ROM | disk | FTP | other *** search
- program TstRoman;
-
- {$APPTYPE CONSOLE}
-
- uses
- SysUtils, AACvRomn;
-
- var
- i, j : integer;
- S : string;
- begin
- writeln('Testing to see we can convert to/from Roman and get same value');
- for i := 1 to 3999 do begin
- S := IntToRoman(i);
- j := RomanToInt(S);
- if (i <> j) then begin
- writeln('error: ', i, ' ', S);
- readln;
- end;
- end;
- writeln('...Done');
- writeln('Testing various bad Roman numbers');
- try
- S := 'MCMDCCM';
- i := RomanToInt(S);
- writeln('error: shouldn''t get ', i, ' with "', S, '"');
- except
- on E: EConvertError do
- writeln(E.Message);
- end;
- try
- S := 'MCCCC';
- i := RomanToInt(S);
- writeln('error: shouldn''t get ', i, ' with "', S, '"');
- except
- on E: EConvertError do
- writeln(E.Message);
- end;
- try
- S := 'MVV';
- i := RomanToInt(S);
- writeln('error: shouldn''t get ', i, ' with "', S, '"');
- except
- on E: EConvertError do
- writeln(E.Message);
- end;
- try
- S := 'IXV';
- i := RomanToInt(S);
- writeln('error: shouldn''t get ', i, ' with "', S, '"');
- except
- on E: EConvertError do
- writeln(E.Message);
- end;
- readln;
- end.
-